local M = _G.ServerOHOH.class.new(script,_G.ServerOHOH.files.Server_PlayerComponent(),script.Parent.Name);
local ServerOHOH = _G.ServerOHOH;
local function_list = _G.ServerOHOH.function_list
local BuffCtrl = nil
function M.new(self,...)
    M(self,...);
end

function M.ctor(self,parent)
    M.super.ctor(self,parent)
    self.player = self.parent
    self.DataStore = self.parent:GetComponent(_G.ServerOHOH.load.Server_PlayerDataComponent());
    
end

--count为负数
function M.UsePotions(self,potionId,count)
    if not BuffCtrl then
        BuffCtrl = self.parent:GetComponent(_G.CommonOHOH.load.Common_BuffCtrl())
    end
    local id = "buff_"..tostring(potionId)
    self.parent:GetComponent(ServerOHOH.load.Server_ItemCtrl()):AddItem({[id]=count},true,true)
    for i = 1, -count, 1 do
        BuffCtrl:CreateBuff(tonumber(potionId))
    end
end

M:RegistFunction(function_list.use_potions,M.UsePotions)
function M.dtor(self)
    M.super.dtor(self)
end

return M